﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace ControlNode
{
    class NetworkCallController
    {
        private ControlNode CNode;
        private readonly Dictionary<String, Socket> cpcc = new Dictionary<string, Socket>();
        private ConnectionController CC;
        private Directory Dir;
        private PacketController PC;

        public NetworkCallController(ControlNode CNode, ConnectionController CC, Directory Dir, PacketController PC)
        {
            this.CNode = CNode;
            this.CC = CC;
            this.Dir = Dir;
            this.PC = PC;

            PacketController.NCC += new PacketController.PCEventHandler(QueryHandler);
        }

        public void QueryHandler(string message, Socket client)
        {
            string[] query = message.Split(' ');

            switch (query[0])
            {
                case "hello":
                    CNode.WriteLine(String.Format("Dołączył CPCC " + query[1]));
                    cpcc.Add(query[1], client);
                    break;

                case "call_request":

                    break;

                case "call_teardown":

                    break;

                case "call_coordination":

                    break;

                default:
                    break;

            }

        }

    }
}
